winsafe\gdi\handles/
hinstance.rs1#![allow(non_camel_case_types, non_snake_case)]
2
3use crate::co;
4use crate::decl::*;
5use crate::gdi::ffi;
6use crate::guard::*;
7use crate::kernel::privs::*;
8
9impl HINSTANCE {
10 #[must_use]
13 pub fn LoadImageBitmap(
14 &self,
15 name: IdObmStr,
16 sz: SIZE,
17 load: co::LR,
18 ) -> SysResult<DeleteObjectGuard<HBITMAP>> {
19 unsafe {
20 ptr_to_sysresult_handle(ffi::LoadImageW(
21 self.ptr(),
22 name.as_ptr(),
23 0,
24 sz.cx,
25 sz.cy,
26 load.raw(),
27 ))
28 .map(|h| DeleteObjectGuard::new(h))
29 }
30 }
31
32 #[must_use]
35 pub fn LoadImageCursor(
36 &self,
37 name: IdOcrStr,
38 sz: SIZE,
39 load: co::LR,
40 ) -> SysResult<DestroyCursorGuard> {
41 unsafe {
42 ptr_to_sysresult_handle(ffi::LoadImageW(
43 self.ptr(),
44 name.as_ptr(),
45 2,
46 sz.cx,
47 sz.cy,
48 load.raw(),
49 ))
50 .map(|h| DestroyCursorGuard::new(h))
51 }
52 }
53
54 #[must_use]
57 pub fn LoadImageIcon(
58 &self,
59 name: IdOicStr,
60 sz: SIZE,
61 load: co::LR,
62 ) -> SysResult<DestroyIconGuard> {
63 unsafe {
64 ptr_to_sysresult_handle(ffi::LoadImageW(
65 self.ptr(),
66 name.as_ptr(),
67 1,
68 sz.cx,
69 sz.cy,
70 load.raw(),
71 ))
72 .map(|h| DestroyIconGuard::new(h))
73 }
74 }
75}